package com.project.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;

import com.project.bean.BuyerCarBean;
import com.project.bean.BuyerInfoBean;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.ResultMap;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface IBuyerInfoMapper extends BaseMapper<BuyerInfoBean> {
    void addBuyerInfo(@Param("buyerId") Integer buyerId,
                      @Param("buyerCarList") List<BuyerCarBean> buyerCarList);

    @Select("SELECT ti.* FROM t_buyer tb,t_buyerInfo ti WHERE " +
            "tb.pk_buyerId = ti.fk_buyerId AND tb.pk_buyerId = #{id}")
    @ResultMap("buyerInfoMapper")
    List<BuyerInfoBean> findInfo(Integer id);

    List<BuyerInfoBean> findList(Integer buyerId);

}
